<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据双向绑定</title>
    <script src="../dist/sact.js"></script>
    <link rel="stylesheet" href="./main.css">
</head>

<style>
    /* 可以设置不同的进入和离开动画 */
    /* 设置持续时间和动画函数 */
    .s-enter-active,
    .s-leave-active {
        transition: all 1s ease;
    }

    .s-enter,
    .s-leave-to {
        opacity: 0;
        /* transform: scale(0); */
    }
</style>


<body>
    <div id="root">
        <transition s-for="item in list">
            <div>
                我要 {{ item }}
            </div>
        </transition>
        <input s-model:value="input">
        <button @click="list.push(input)">添加</button>
        <button @click="list.pop()">删除</button>
    </div>
</body>
<script>
    Sact.link()
        .el("#root")
        .data({
            list: ["吃饭", "睡觉", "学习"],
            input: "",
        })
        .do;
</script>

</html>